/* 
 * File:   main.cpp
 * Author: taylor
 *
 * Created on November 2, 2012, 11:08 AM
 */

#include <cstdlib>
#include<iostream>

#include "DocumentManager.h"
#include "TreeInterface.h"
#include "AVLTreeAdapter.h"
#include "HashTableAdapter.h"
#include "Term.h"
#include "rapidxml.hpp"
#include "MaintenanceMode.h"
#include "InteractiveMode.h"
#include "StressTestMode.h"

#define DEBUG1 true

using namespace std;
using namespace rapidxml;

void outputModeOptions();
void pickMode(int mode, DocumentManager* dm);

int main(int argc, char** argv) {
    
    DocumentManager* dm;
    
    if(DEBUG1) {
        string str;
        int mode;
        
        outputModeOptions();
                
        while(cin >> str) {
            mode = atoi(str.c_str());
            pickMode(mode,dm);
        }
    }
        
    //dm->addDocumentsFromFile("DocumentSamples/WikiDumpSample.xml");
 
    return 0;
}

void outputModeOptions() {
    cout << "Please pick a mode you would like to work in." << endl;
        cout << "\t1. Maintenance Mode." << endl;
        cout << "\t2. Interactive Mode." << endl;
        cout << "\t3. Stress Test Mode." << endl;
        cout << "\t4. Quit Program." << endl << endl;
}

void pickMode(int mode,DocumentManager *dm) {
    string str;
    
    switch(mode) {
        case 1: //Maintenance
        {    
            MaintenanceMode mm(dm);
            mm.enableMode();
            
            outputModeOptions();
            break;
        }
        case 2: //Interactive
        {
            InteractiveMode im(dm);
            im.enableMode();
            
            outputModeOptions();
            break;
        }
        case 3: //Stress Test
        {
            StressTestMode sm;
            cout << "Okay cool." << endl;
            
            outputModeOptions();
            break;
        }
        case 4: //Quit
        {
            exit(EXIT_SUCCESS);
        }   
    }
}
